import java.util.HashSet;
import java.util.Set;

public class SetUniqueness {
    public static void main(String[] args) {
        Set<String> set = new HashSet<>();
        int sizeBefore = set.size();

        // 添加字符串，包含重复项
        set.add("apple");
        set.add("banana");
        set.add("apple");

        int sizeAfter = set.size();

        // 判断是否存在重复元素
        boolean hasDuplicate = sizeBefore == sizeAfter;
        System.out.println("集合中存在重复元素: " + hasDuplicate);
    }
}
